function loadScript(url, callback) {

  var script = document.createElement('script');

  if ( script.readyState ) { // IE

    script.onreadystatechange = function(){

      if( script.readyState === "loaded" || script.readyState === "complete") {

        script.onreadystatechange = null; // 同时检查两种状态，只要有一种触发就删除事件处理器，避免触发两次
        callback();
      }

    }

  }else{

    script.onload = function(){
      callback();
    }

  }


  script.src = url;
  document.getElementsByTagName('head')[0].appendChild(script);
}
